<template>
  <div>
  <div class="outmain ba_f">
    <div class="shuju_title mar_b20">
      <div class="shuju_title_text">
        <span>预约订单</span>
      </div>
    </div>
    <div class="flex-bet flex-y-top">
      <el-form :inline="true" :model="formInline" class="demo-form-inline searchform">
        <div>
          <el-form-item label="订单号">
            <el-input v-model="formInline.keyword" size="medium" placeholder="请输入订单号" @input="onSearch"></el-input>
          </el-form-item>
          <el-form-item label="下单时间"  class="mar_l20">
            <el-radio-group v-model="formInline.tabPosition" class="mar_r20">
              <el-radio-button label="top">今天</el-radio-button>
              <el-radio-button label="right">昨天</el-radio-button>
              <el-radio-button label="bottom">一周</el-radio-button>
            </el-radio-group>
            <el-date-picker
                    v-model="formInline.timeData"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item  class="mar_l20">
            <el-button type="primary" @click="onSearch" size="medium">搜索</el-button>
          </el-form-item>
        </div>
      </el-form>
    </div>
    <div class="mar_t20">
      <el-calendar v-model="value"></el-calendar>
    </div>
  </div>
  </div>
</template>
<script>
  import {getConfig, postConfig} from "@/api/setup";
  import {changeDate} from "@/utils/index";
  export default {
    created() {
      // this.init();
    },
    data () {
      return {
        formInline: {
          tabPosition: 'top',
          keyword: '',
          userChannel: '',
          timeData: ''
        },
        value: new Date(),
      }
    },
    methods: {
      async fetchData() {
        var params = {
          page: this.page.currentPage,
          keyword: this.formInline.keyword,
          userChannel: this.formInline.userChannel,
          startTime:this.formInline.timeData?changeDate(this.formInline.timeData[0]):'',
          endTime:this.formInline.timeData?changeDate(this.formInline.timeData[1]):'',
        }
        const {data, count} = await getMemberLis(params);
        this.list = data;
        this.page.total = count;
        this.listLoading = false;
      },
      setSelectRows(val) {
        this.selectRows = val;
      },
      handleCurrentChange(val) {
        this.page.currentPage = val;
        this.fetchData();
      },
      submitForm() {
        this.$refs["form"].validate(async (valid) => {
          if (valid) {
            this.form.ident = 'storeSet'
            const {msg} = await postConfig(this.form);
            this.$baseMessage(msg, "success");
            this.init();
          } else {
            return false;
          }
        });
      },
    },
  }
</script>
